//
//  ZLHomeTopPortCell.m
//  ZLExamination
//
//  Created by Zheng on 2017/8/14.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "ZLHomeTopPortCell.h"

@interface ZLHomeTopPortCell ()

@end

@implementation ZLHomeTopPortCell

#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        for (int i = 0; i < 4; i++) {
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = (CGRect){kSCREEN_WIDTH/4*i,0,kSCREEN_WIDTH/4,kSCREEN_WIDTH/4};
            btn.tag = 50000+i;
            [btn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"home_et_%d",i]] forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(btnClickAction:) forControlEvents:UIControlEventTouchUpInside];
            [self.contentView addSubview:btn];
        }
    }
    return self;
}

#pragma mark - 点击事件
- (void)btnClickAction:(UIButton *)sender {
    ZLHomeTopPortCellActionStyle style = ZLHomeTopPortCellActionStyleFirstKind;
    switch (sender.tag-50000) {
        case 0:
            style = ZLHomeTopPortCellActionStyleFirstKind;
            break;
        case 1:
            style = ZLHomeTopPortCellActionStyleSecondeKind;
            break;
        case 2:
            style = ZLHomeTopPortCellActionStyleThirdKind;
            break;
        case 3:
            style = ZLHomeTopPortCellActionStyleLearnning;
            break;
    }
    
    if (_clickActionBlock != nil && _clickActionBlock != NULL) {
        _clickActionBlock(style);
    }
}


@end
